package com.lmq.innerclasses;// innerclasses/Parcel8.java
// (c)2021 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// Calling the base-class constructor

public class Parcel8 {
  public Wrapping wrapping(int x) {
    // Base constructor call:
    return new Wrapping(x) {          // [1]
      @Override public int value() {
        return super.value() * 47;
      }
    };                                // [2]
  }
  public static void main(String[] args) {
    Parcel8 p = new Parcel8();
    Wrapping w = p.wrapping(10);
  }
}

/**
 * [1] You pass the appropriate argument to the base-class constructor.
 * [2] The semicolon at the end of an anonymous inner class doesn't mark the end
 * of the class body. Instead, it marks teh end of the expression that happens to
 * contain the anonymous class. Thus, it's identical to the way the semicolon is used everywhere else.
 * For variety, Wrapping's constructor requires an argument.
 * You can also perform initialization when you define fields in an anonymous class:
 *
 */
